class Report < ActiveRecord::Base
  paginates_per 10

  has_one :document, :as => :source, :dependent => :destroy
  belongs_to :conference

  default_scope order('created_at DESC')

  after_initialize lambda { |r| r.build_document }, :unless => :document

  accepts_nested_attributes_for :document

  validates_with ReportValidator

  validates_presence_of :document, :conference
end
